#include "bigsave.h"
#include "fstream"
#include "sstream"
#include "student.h"
#include "teacher.h"
#include "paper.h"
#include "program.h"
#include <vector>
#include <QDebug>
extern vector<student*>sdata;
extern vector<Teacher*>tdata;
extern vector<paper*>pdata;
extern vector<Program*>prdata;
void bigsave(){
    unsigned int i;
    ostringstream os;
    ofstream outteacher;
    outteacher.open("C:/sr_system/Zteacher.txt");
    for(i=0;i<tdata.size();i++){
        os.str("");
        tdata[i]->save(os);
        outteacher<<os.str();
    }
//    os.str("");
//    tdata[i]->save(os);
//    outteacher<<os.str();
    outteacher.close();
    ofstream outstudent;
    outstudent.open("C:/sr_system/Zstudent.txt");
    for(i=0;i<sdata.size();i++){
        os.str("");
        sdata[i]->save(os);
        outstudent<<os.str();
    }
//    os.str("");
//    sdata[i]->save(os);
//    outstudent<<os.str();
    outstudent.close();
    ofstream outprogram;
    outprogram.open("C:/sr_system/Zprogram.txt");
    for(i=0;i<prdata.size();i++){
        os.str("");
        prdata[i]->save(os);
        outprogram<<os.str();
    }
//    os.str("");
//    prdata[i]->save(os);
//    outprogram<<os.str();
    outprogram.close();
    ofstream outpaper;
    outpaper.open("C:/sr_system/Zpaper.txt");
    for(int i=0;i<pdata.size();i++){
        os.str("");
        pdata[i]->save(os);
        outpaper<<os.str();
    }
//    os.str("");
//    pdata[i]->save(os);
//    outpaper<<os.str();
    outpaper.close();

}
